"use strict";

/**
 * 登录账号相关接口调用
 */
import Ajax from "../libs/ajax";
import md5 from '../libs/md5.min';

/**
 * 管理员登录
 * @param user_acc
 * @param user_pwd
 * @returns {Promise.<TResult>|*|Promise<any | any>|Promise<any>}
 */
export function login(user_acc, user_pwd) {
    return Ajax.ajax({
        url: "/api/account/login?user_acc=" + user_acc + "&user_pwd=" + md5(user_pwd),
        method: "get"
    }).then(res => res.data);
}

/**
 * 修改密码
 */
export function modPwd(user_acc, pwd_old, pwd_new) {
    return Ajax.ajax({
        url: "/api/account/password",
        data: {user_acc: user_acc, pwd_old: md5(pwd_old), pwd_new: md5(pwd_new)},
        method: "post"
    }).then(res => res.data);
}
